package devdocs

class RenderAjaxSelectTagLib {
	
	def ajaxSelect = { attrs, body ->

		def rf = remoteFunction(
            controller:attrs.controller, 
            action:attrs.action, 
            params: '\'id=\' + this.value + \'&update=' + attrs.updateId +'\'',
			onLoading: '$(\'#spinner\').show();onLoadingSelect(\'' + attrs.updateId +'\')', 
			onComplete: '$(\'#spinner\').hide()',
			onSuccess:'updateSelect(data)')
		out << select(id: attrs.id, 
			name:attrs.name, 
			from:attrs.from, 
			optionKey: attrs.optionKey, 
			value: attrs.value, 
			onchange: rf, 
			style: attrs?.style,
			noSelection: attrs?.noSelection,
			'class': attrs?.class)
		
	}

}
